package com.liangsong.designpattern.factory;

import com.liangsong.designpattern.factory.common.*;

public class BJFactory implements IFactroy{
    @Override
    public Baozi createBaozi(String type) {
        return switch (type) {
            case "suancai" -> new SuancaiBaozi();
            case "pork" -> new PorkBaozi();
            default -> throw new IllegalArgumentException("没有这种包子");
        };
    }

    @Override
    public Cake createCake(String type) {
        return switch (type) {
            case "suancai" -> new SuancaiCake();
            case "pork" -> new PorkCake();
            default -> throw new IllegalArgumentException("没有这种包子");
        };
    }

}
